from _app import jinja
from appconfigsvr.auth.permission import permission_check, get_permission


@permission_check()
async def html(request, template_dir, html_file_name):
    context = {}
    context['permission'] = await get_permission(request=request)
    context['username'] = request['session'].get("user")
    return jinja.render('%s/%s.html' % (template_dir, html_file_name), request, **context)
